package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.WorkOrderOperationRecordOperationRecordTypeEnum;
import com.eastfair.venueservice.enumeration.WorkOrderOperationRecordDisposalResultEnum;
import com.eastfair.venueservice.enumeration.WorkOrderOperationRecordOperationTypeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 工单操作记录
 * </p>
 *
 * @author linan
 * @since 2022-11-09
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("vsm_work_order_operation_record")
@ApiModel(value = "WorkOrderOperationRecord", description = "工单操作记录")
@AllArgsConstructor
public class WorkOrderOperationRecord extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 工单编号
     */
    @ApiModelProperty(value = "工单编号")
    @Size(max = 255, message = "工单编号长度不能超过255")
    @TableField(value = "work_order_no", condition = LIKE)
    @Excel(name = "工单编号")
    private String workOrderNo;

    /**
     * 操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结}
     */
    @ApiModelProperty(value = "操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结}")
    @TableField(value = "operation_type")
    @Excel(name = "操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结}", replace = {"生成工单_CREATE", "接收工单_ACCEPT", "处理工单_DISPOSAL", "工单完结_FINISH",  "_null"})
    private WorkOrderOperationRecordOperationTypeEnum operationType;

    /**
     * 人员id
     */
    @ApiModelProperty(value = "人员id")
    @TableField(value = "user_id")
    @Excel(name = "人员id")
    private Long userId;

    /**
     * 人员姓名
     */
    @ApiModelProperty(value = "人员姓名")
    @Size(max = 255, message = "人员姓名长度不能超过255")
    @TableField(value = "user_name", condition = LIKE)
    @Excel(name = "人员姓名")
    private String userName;

    /**
     * 部门id
     */
    @ApiModelProperty(value = "部门id")
    @TableField(value = "org_id")
    @Excel(name = "部门id")
    private Long orgId;

    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    @Size(max = 255, message = "部门名称长度不能超过255")
    @TableField(value = "org_name", condition = LIKE)
    @Excel(name = "部门名称")
    private String orgName;

    /**
     * 附件url
     */
    @ApiModelProperty(value = "附件url")
    @Size(max = 255, message = "附件url长度不能超过255")
    @TableField(value = "file_url", condition = LIKE)
    @Excel(name = "附件url")
    private String fileUrl;

    /**
     * 上一环节完成时间
     */
    @ApiModelProperty(value = "上一环节完成时间")
    @TableField(value = "last_link_finish_time")
    @Excel(name = "上一环节完成时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime lastLinkFinishTime;

    /**
     * 备注信息
     */
    @ApiModelProperty(value = "备注信息")
    @Size(max = 255, message = "备注信息长度不能超过255")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注信息")
    private String remark;

    /**
     * 处理结果 #{SETUP_COMPLETE:安装完毕;NO_INSTALLATION_REQUIRED:无需安装;TROUBLE_SHOOTING:故障维修;DAMAGE_REPAIR:损坏维修;FAILURE_REPLACEMENT:故障更换;REPLACE_IF_DAMAGED:损坏更换;ARTIFICIAL_DAMAGE:人为损坏（赔偿）;SITE_ACCEPTANCE_IS_QUALIFIED:场地验收合格;UNQUALIFIED_SITE_DAMAGE:场地损坏不合格;FINISH:完成}
     */
    @ApiModelProperty(value = "处理结果 #{SETUP_COMPLETE:安装完毕;NO_INSTALLATION_REQUIRED:无需安装;TROUBLE_SHOOTING:故障维修;DAMAGE_REPAIR:损坏维修;FAILURE_REPLACEMENT:故障更换;REPLACE_IF_DAMAGED:损坏更换;ARTIFICIAL_DAMAGE:人为损坏（赔偿）;SITE_ACCEPTANCE_IS_QUALIFIED:场地验收合格;UNQUALIFIED_SITE_DAMAGE:场地损坏不合格;FINISH:完成}")
    @TableField(value = "disposal_result")
    @Excel(name = "处理结果 #{SETUP_COMPLETE:安装完毕;NO_INSTALLATION_REQUIRED:无需安装;TROUBLE_SHOOTING:故障维修;DAMAGE_REPAIR:损坏维修;FAILURE_REPLACEMENT:故障更换;REPLACE_IF_DAMAGED:损坏更换;ARTIFICIAL_DAMAGE:人为损坏（赔偿）;SITE_ACCEPTANCE_IS_QUALIFIED:场地验收合格;UNQUALIFIED_SITE_DAMAGE:场地损坏不合格;FINISH:完成}", replace = {"安装完毕_SETUP_COMPLETE", "无需安装_NO_INSTALLATION_REQUIRED", "故障维修_TROUBLE_SHOOTING", "损坏维修_DAMAGE_REPAIR", "故障更换_FAILURE_REPLACEMENT", "损坏更换_REPLACE_IF_DAMAGED", "人为损坏（赔偿）_ARTIFICIAL_DAMAGE", "场地验收合格_SITE_ACCEPTANCE_IS_QUALIFIED", "场地损坏不合格_UNQUALIFIED_SITE_DAMAGE", "完成_FINISH",  "_null"})
    private WorkOrderOperationRecordDisposalResultEnum disposalResult;

    /**
     * 操作记录类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单;REASSIGN:重新派工;CANCEL:作废工单}
     */
    @ApiModelProperty(value = "操作记录类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单;REASSIGN:重新派工;CANCEL:作废工单}")
    @TableField(value = "operation_record_type")
    @Excel(name = "操作记录类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单;REASSIGN:重新派工;CANCEL:作废工单}", replace = {"生成工单_CREATE", "接收工单_ACCEPT", "处理工单_DISPOSAL", "工单完结_FINISH", "撤销工单_REVOKE", "重新派工_REASSIGN", "作废工单_CANCEL",  "_null"})
    private WorkOrderOperationRecordOperationRecordTypeEnum operationRecordType;


    @Builder
    public WorkOrderOperationRecord(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String workOrderNo, WorkOrderOperationRecordOperationTypeEnum operationType, Long userId, String userName, Long orgId, String orgName, 
                    String fileUrl, LocalDateTime lastLinkFinishTime, String remark, WorkOrderOperationRecordDisposalResultEnum disposalResult, WorkOrderOperationRecordOperationRecordTypeEnum operationRecordType) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.workOrderNo = workOrderNo;
        this.operationType = operationType;
        this.userId = userId;
        this.userName = userName;
        this.orgId = orgId;
        this.orgName = orgName;
        this.fileUrl = fileUrl;
        this.lastLinkFinishTime = lastLinkFinishTime;
        this.remark = remark;
        this.disposalResult = disposalResult;
        this.operationRecordType = operationRecordType;
    }

}
